import dt from '@dt/dt'
import server from '@dt/server/dt'

const api = {
  list: server.api().post('/dt-building/buCommercePoints/commercePage'),
  edit: server.api().post('/dt-building/buCommercePoints/commerceSaveOrUpdate'),
  remove: server.api().get('/dt-building/buCommercePoints/commerceRemoveById')
}

function list(data) {
  data.buildingId = dt.buildInfo().housesId
  data.sidx = 'createTime'
  data.sord = 'desc'
  return api.list.fetch(data)
}

function edit(data) {
  return api.edit.fetch(data)
}

function remove(id) {
  return api.remove.fetch({ id })
}

export default {
  list,
  edit,
  remove
}
